import pandas as pd
import numpy as np


dates = pd.date_range('20130101',periods=6)
df = pd.DataFrame(np.arange(24).reshape(6,4),index=dates,columns=list('ABCD'))
df.iloc[0,1] = np.nan
df.iloc[1,2] = np.nan

# 按行查找，有nan丢掉
print(df.dropna(axis=0,how='any'))

# 按列查找，全nan丢掉
print(df.dropna(axis=1,how='all'))

# 将nan值填充
print(df.fillna(value=-1))

# 检查数据中是否有缺失数据
print(np.any(df.isnull())) # any()有True就True